package org.luxor.html.service;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 * @author Mr.yan @date 2019/9/22
 */
@Service
public class TemplateService {

    @Value("${luxor.template.skin:default}")
    private String themeSkin;

    public String getManageUri(String uri) {
        return "manage/" + uri;
    }

    public String getThemeUri(String uri) {
        return themeSkin + "/" + uri;
    }

    /**
     * 后台首页(默认)模板
     */
    public String getManageIndex() {
        return getManageUri("index");
    }

    /**
     * 首页(默认)模板
     */
    public String getIndex() {
        return getThemeUri("index");
    }

    /**
     * 登陆页面
     */
    public String getLogin() {
        return getManageUri("security/login");
    }

    /**
     * 重定向
     */
    public String getRedirect(String uri) {
        return "redirect:/" + uri;
    }

    public String getError() {
        return getThemeUri("error");
    }

    public String get403() {
        return getThemeUri("403");
    }

    public String get404() {
        return getThemeUri("404");
    }

    public String get500() {
        return getThemeUri("500");
    }

}
